package com.yunsc.shop.utils;

import com.yunsc.common.exception.YunscException;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-05-23 15:07
 */
@Component
public class ClientInfoUtils {

    @Resource
    private HttpServletRequest request;

    public Integer getCurrentStoreId() {
        String storeId = request.getHeader("storeId");
        if (storeId == null) {
            throw new YunscException("错误请求，请先登录");
        }
        return Integer.parseInt(storeId);
    }


    public String getCurrentPlatform() {
        String platform = request.getHeader("platform");
        if (platform == null) {
            throw new YunscException("错误请求，请先登录");
        }
        return platform;
    }



}
